//
//  RoomChiefListTableViewCell.m
//  Fangmm
//
//  Created by 阮琦 on 16/3/2.
//  Copyright © 2016年 com.fangmm. All rights reserved.
//

#import "RoomChiefListTableViewCell.h"

#import "ACMacros.h"

#import "Seat.h"

@implementation RoomChiefListTableViewCell

- (void)awakeFromNib {
    // Initialization code
    NSArray *chooseBtnArray = @[self.aChooseButton, self.bChooseButton , self.cChooseButton];
    for (UIButton *button in chooseBtnArray) {
        button.layer.cornerRadius = 10.0;
        button.layer.borderWidth = 0.5;
        button.layer.borderColor = [RGBACOLOR(255, 118, 108, 1) CGColor];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

- (IBAction)chooseA:(UIButton *)sender {
    if (!self.aPriceLabel.hidden) {
        NSLog(@"%@",self.aPriceLabel.text);
        Seat *seat = [[Seat alloc]initWithDic:self.team.seats[0]];
        [self.delegate clickToChooseRoom:[NSString stringWithFormat:@"%ld-RoomA",self.tag + 1] WithSeatId:seat.seatId InTeam:self.team.teamId WithRent:seat.rent];
        if ([self.delegate respondsToSelector:@selector(clickButton:Index:ButtonTag:)]) {
            [self.delegate clickButton:sender Index:self.tag ButtonTag:0];
        }
    }
}
- (IBAction)chooseB:(UIButton *)sender {
    if (!self.bPriceLabel.hidden) {
        NSLog(@"%@",self.aPriceLabel.text);
        Seat *seat = [[Seat alloc]initWithDic:self.team.seats[1]];
        [self.delegate clickToChooseRoom:[NSString stringWithFormat:@"%ld-RoomB",self.tag + 1] WithSeatId:seat.seatId InTeam:self.team.teamId WithRent:seat.rent];
        if ([self.delegate respondsToSelector:@selector(clickButton:Index:ButtonTag:)]) {
            [self.delegate clickButton:sender Index:self.tag ButtonTag:1];
        }
    }
}
- (IBAction)chooseC:(UIButton *)sender {
    if (!self.cPriceLabel.hidden) {
        NSLog(@"%@",self.aPriceLabel.text);
        Seat *seat = [[Seat alloc]initWithDic:self.team.seats[2]];
        [self.delegate clickToChooseRoom:[NSString stringWithFormat:@"%ld-RoomC",self.tag + 1] WithSeatId:seat.seatId InTeam:self.team.teamId WithRent:seat.rent];
        if ([self.delegate respondsToSelector:@selector(clickButton:Index:ButtonTag:)]) {
            [self.delegate clickButton:sender Index:self.tag ButtonTag:2];
        }
    }
}

- (IBAction)header_A_ButtonClicked:(UIButton *)sender {
    [self.delegate clickToShowUserMainInfoWithTag:0 WithIndex:self.tag];
}
- (IBAction)header_B_ButtonClicked:(UIButton *)sender {
    [self.delegate clickToShowUserMainInfoWithTag:1 WithIndex:self.tag];
}
- (IBAction)header_C_ButtonClicked:(UIButton *)sender {
    [self.delegate clickToShowUserMainInfoWithTag:2 WithIndex:self.tag];
}

@end
